package web.java.upload;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class Demo01_Upload extends HttpServlet{
	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		String params=request.getQueryString();
		InputStream in=request.getInputStream();
		InputStreamReader reader=new InputStreamReader(in,"utf-8");
		BufferedReader buf=new BufferedReader(reader);
		String line;
		while((line=buf.readLine())!=null){
			byte[] b=line.getBytes("gbk");
			System.out.println(new String(b,"gbk"));
		}
		buf.close();
	}
	
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(req, resp);
	}
}
